package base

import (
	"fmt"
	"reflect"
)

func VarTest() {
	var name string = "联想"
	var name1 string = "aa"
	fmt.Println(name, name1)
	var name3, name4 string = "aa", "bb"
	fmt.Println(name3, name4)
	var (
		name5 string = "ee"
		name6 string
	)
	fmt.Println(name5, name6)
	//简化声明并赋值变量
	a := true
	b := "load"
	f := 3.14
	fmt.Println(a, b, f)
	//获取变量类型
	fmt.Println("b的类型是:", reflect.TypeOf(b))
	//常量
	const c1, c2, c3 = 1, 2, 3
	// cannot assign to c3 ,常量赋值后不可修改
	//c3 = 2
	fmt.Println(c1, c2, c3)
}
